{% extends "base.html" %}
{% load i18n %}
<html lang="en">
<head>
    <title>Search{% if query %} Results{% endif %}</title>
</head>
{% block content %}
<body>
  <h1>Search</h1>
  <form action="." method="GET">
    <label for="q">Type the job_no you want to search: </label>
    <input type="text" name="q" value="{{ query|escape }}" type="number" pattern="[0-9]+" min="1">
    <input type="submit" value="Search">
  </form>
{% if query %}
    <h2>Results for job_no :{{ query|escape }}</h2>

    {% if job %}
	
	<table border="1">
	
	<tr>
		<th>Job Id.</th>
		<th>Name & Address</th>
		<th>Work Done</th>
		<th>Site</th>
		<th>Amount</th>
		<th>Operations to be Performed</th>
	</tr>
	{% for client in job %}
	<tr>
		<td>{{client.id}}
		<td>{{client.client__client__first_name}} from {{client.client__client__address_1}},{{client.client__client__city}}</td>
		<td> {{client.clienteditjob__material__name}}</td>	
		<td>{{client.site}}</td>
		<td>{{client.testtotalperf__unit_price}}</td>
		<td><a href="/automation/tcc/editwork/?id={{client.id}}">Edit & Add this work</a></td>
    </tr>
	{% endfor %}

	</table>
	{% else %}
	<p>This Job no does not exist.</p>
	{% endif %}
{% endif %}
</body>
</html>
{% endblock %}
